from src.Terminal import *
import csv

vins_file = "../registerdb/vins_org.csv"

GW_HOST = '172.16.8.91'
GW_PORT = 5061


def start_terminal():
    terminal_list = []
    csvfile = csv.reader(open(vins_file, 'r'))
    for line in csvfile:
        vin = line[0]
        iccid = vin + "000"
        t = Terminal(host=GW_HOST, port=GW_PORT, vin=vin, iccid=iccid)
        terminal_list.append(t)
        t.start()

    return terminal_list


if __name__ == '__main__':
    terminal_list = start_terminal()
    time.sleep(60)

    for t in terminal_list:
        t.stop()
